<div class="row-fluid">
    <div class="span12">
        <div class="grid simple">
            <div class="grid-title no-border">
                <h4>Поля с <span class="required"> * </span> обязательны для заполнения.</h4>
            </div>
            <div class="grid-body no-border">
                <div class="form">

                    <?php
                    $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
                        'id' => 'brand-form',
                        // Please note: When you enable ajax validation, make sure the corresponding
                        // controller action is handling ajax validation correctly.
                        // There is a call to performAjaxValidation() commented in generated controller code.
                        // See class documentation of CActiveForm for details on this.
                        'htmlOptions' => array('enctype' => 'multipart/form-data'),
                        //'enableAjaxValidation' => true,
                        'clientOptions' => array(
                            'validateOnSubmit' => true,
                        ),
                    ));
                    ?>

                    <?php echo $form->errorSummary($model); ?>

                    <?php echo $form->textFieldControlGroup($model, 'brand', array('span' => 5, 'maxlength' => 255)); ?> 
                    
                    <?php echo $form->textFieldControlGroup($model, 'pageTitle', array('span' => 5, 'maxlength' => 255)); ?> 

                    <?php echo $form->textFieldControlGroup($model, 'pageUrl', array('span' => 5, 'maxlength' => 255)); ?>	

                    <?php echo $form->dropDownListControlGroup($model, 'pageActive', array('Не опубликован', 'Опубликован')); ?>

                    <?php echo $form->hiddenField($model, 'pageImages'); ?> 
                    
                    <img src="<?php echo $model->pageImages; ?>">
                    
                    <div class="form-actions">
                        <?php
                        echo TbHtml::submitButton($model->isNewRecord ? 'Добавить' : 'Save', array(
                            'color' => TbHtml::BUTTON_COLOR_PRIMARY,
                            'size' => TbHtml::BUTTON_SIZE_LARGE,
                        ));
                        ?>
                    </div>
                    <script>
                        $(document).ready(function() {
<?php if (!$model->isNewRecord): ?>
                                $.post('<?php echo CController::createUrl('categories/getData'); ?>', {type: $('#type').val(), value: $('#value').val()}, function(response) {
                                    $('#result').html(response);
                                });
<?php endif; ?>
                            $('#Brand_pageTitle').keyup(function() {
                                $('#Brand_pageUrl').val(cyr2lat($(this).val()));
                            });
                        });
                    </script>
                    <?php $this->endWidget(); ?>

                </div><!-- form -->
            </div>
        </div>	
    </div>
</div>